//
//  OldPhotoBaseController.m
//  OldPhoto
//
//  Created by 蓝鳍互娱 on 2024/7/29.
//

#import "OldPhotoBaseController.h"
#import "OldPhotoMainController.h"
@interface OldPhotoBaseController ()
@property (nonatomic,strong)UILabel * oldPhotoNavTitleLab;
@property (nonatomic,strong) UIImageView *oldPhotoBgImgView;
@end

@implementation OldPhotoBaseController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.hidden = YES;
    [self creatOldPhotoInitView];
}
- (void)creatOldPhotoInitView{
    self.oldPhotoBgImgView = [[UIImageView alloc] init];
    self.oldPhotoBgImgView.userInteractionEnabled = true;
    [self.view addSubview:self.oldPhotoBgImgView];
    [self.oldPhotoBgImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@(OldPhotoRatio(0)));
    }];
}
- (void)oldPhotoHomeSet{
    OldPhotoMainController *oldPhotoMainCtrl = [[OldPhotoMainController alloc] init];
    [self.navigationController pushViewController:oldPhotoMainCtrl animated:true];
}
- (void)creatOldPhotoNavView{
    UIButton * oldPhotoNavBackBtn = [[UIButton alloc] init];
    [oldPhotoNavBackBtn setBackgroundImage:OldPhotoImageNamed(@"OldPhotoMainBack") forState:UIControlStateNormal];
    [oldPhotoNavBackBtn addTarget:self action:@selector(oldPhotoNavBack) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoNavBackBtn];
    [oldPhotoNavBackBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(24)));
        make.top.equalTo(@(OldPhotoRatio(22) + OldPhotoTopSafeHeight));
        make.width.equalTo(@(OldPhotoRatio(64)));
        make.height.equalTo(@(OldPhotoRatio(64)));
    }];
    self.oldPhotoNavTitleLab = [[UILabel alloc] init];
    self.oldPhotoNavTitleLab.textColor = OldPhotoHex(@"#000000");
    self.oldPhotoNavTitleLab.font = [UIFont systemFontOfSize:OldPhotoRatio(34) weight:UIFontWeightRegular];
    [self.view addSubview:self.oldPhotoNavTitleLab];
    [self.oldPhotoNavTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(oldPhotoNavBackBtn);
        make.centerX.equalTo(self.view);
        make.height.equalTo(@(OldPhotoRatio(50)));
    }];
}
-(void)setOldPhotoNavTitle:(NSString *)oldPhotoNavTitle{
    _oldPhotoNavTitle = oldPhotoNavTitle;
    self.oldPhotoNavTitleLab.text = _oldPhotoNavTitle;
}
-(void)setOldPhotoBgImg:(NSString *)oldPhotoBgImg{
    _oldPhotoBgImg = oldPhotoBgImg;
    self.oldPhotoBgImgView.image = OldPhotoImageNamed(_oldPhotoBgImg);
}
- (void)oldPhotoNavBack{
    [self.navigationController popViewControllerAnimated:true];
}
@end
